<?php
/*
 * @Author: 李志刚
 * @CopyRight: 2020-2030 衡水山木枝技术服务有限公司
 * @Date: 2021-08-28 09:40:48
 * @Description: 租户及员工操作日志
 * @LastEditors: 李志刚
 * @LastEditTime: 2021-09-13 09:16:14
 * @FilePath: /qingshanERP/database/migrations/qingshanerp/2021_08_28_094048_create_tenant_staff_logs.php
 */

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateTenantLogs extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('tenant_logs', function (Blueprint $table) {
            $table->id();
            $table->foreignId('tenant_id')->default(0)->comment('租户ID');
            $table->string('tenant_name', 50)->nullable()->comment('租户名');
            $table->foreignId('staff_id')->default(0)->comment('租户员工ID');
            $table->string('staff_name', 50)->nullable()->comment('员工名');
            $table->string('method', 20)->comment('操作类型');
            $table->string('url')->comment('请求地址');
            $table->string('action_name')->nullable()->comment('操作名');
            $table->text('data')->nullable()->comment('请求数据');
            $table->text('res_data')->nullable()->comment('返回值');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('tenant_staff_logs');
    }
}
